home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 034a / dfqbx10.zip / PBC-SUBS.DOC < prev   
Text File  |  1991-10-22  |  21KB  |  648 lines

  1.  
  2.  The following routines are available for your use. DoorFrame itself does not
  3. use most of the routines so you may retain or delete them from DFRAMEX.LIB as
  4. you see fit (the ones DoorFrame uses are noted - DON'T DELETE THEM!). The
  5. library is modularized so if you don't CALL a routine in your code, it will
  6. not be included in the final .EXE file. Since these routines come from the
  7. PBClone library by Tom Hanlin, I have taken the liberty of including his
  8. descriptions of the routines.
  9.  
  10.  
  11. Name  : BigPrint        (Called by DoorFrame - DON'T DELETE)
  12. Class : Display
  13. Level : BIOS
  14.  
  15. As the name suggests, this routine displays text in large characters.  How
  16. large?  Eight times as high and as wide as normal!  Each "big character" will
  17. be composed of many normal-sized characters.  You may choose the normal
  18. character used to create the big characters (the default is a CHR$(219) solid
  19. block character, if you pass a null string here).
  20.  
  21. You should avoid using CHR$(128) to CHR$(255) when in either of the CGA
  22. graphics modes, as many CGAs are unable to display these characters when in
  23. graphics mode.
  24.  
  25.    BigPrint St$, FormCh$, Row%, Column%, Attr%
  26.  
  27. St$       string to display in big characters
  28. FormCh$   character used to compose the big characters
  29. Row%      starting row
  30. Column%   starting column
  31. Attr%     color/attribute of big characters (see CalcAttr)
  32.  
  33.  
  34. Name  : BIOSInkey
  35. Class : Input
  36. Level : BIOS
  37.  
  38. BIOSInkey works like INKEY$, but it gets its key directly by asking the BIOS.
  39. The primary advantage of this is that you get the "scan" code as well as the
  40. ASCII code of the key.  The scan code is independent of the shift status--
  41. for instance, the scan code for "A" is the same as the scan code for "a" or
  42. Control-A or Alt-A.  This can be very handy.
  43.  
  44. If there is no key available, both the scan code and ASCII code will be zero.
  45.  
  46.    BIOSInkey AscCode%, ScanCode%
  47.  
  48. -------
  49. AscCode%    ASCII code of the key, if any
  50. ScanCode%   scan code of the key, if any
  51.  
  52.  
  53. Name  : CDROM
  54. Class : Disk / Equipment
  55. Level : DOS
  56.  
  57. This routine tells you whether the Microsoft CD-ROM Extensions are installed.
  58. If so, it tells you what the letter of the first CD-ROM logical drive is and
  59. how many logical drives exist.
  60.  
  61. Note: The CD-ROM installation check conflicts with the GRAPHICS.COM
  62. installation check for DOS 4.0, due to some screw-up at IBM or Microsoft.
  63. This may cause unexpected results.  I'm not yet sure whether DOS 5.0 is
  64. similarly afflicted.
  65.  
  66.    FirstDrive$ = "x"
  67.    CDROM FirstDrive$, Drives%
  68.  
  69. -------
  70. FirstDrive$   letter of the first logical drive (init to at least one space!)
  71. Drives%       number of logical drives available (0 if no CD-ROM is there)
  72.  
  73.  
  74. Name  : DelFile                 (Called by DoorFrame - DON'T DELETE!)
  75. Class : Disk
  76. Level : DOS
  77.  
  78. This works like the DOS DEL (or ERASE) command, although it does not allow
  79. wildcards.  The specified file is deleted.  Full path specifications are
  80. supported, including drive and subdirectory specs.
  81.  
  82.    DelFile FileName$, ErrCode%
  83.  
  84. FileName$   name of the file to delete
  85. -------
  86. ErrCode%    0 if no error, else DOS Error
  87.  
  88.  
  89. Name  : DriveSpace&
  90. Class : Disk
  91. Level : DOS
  92.  
  93. This routine tells you how many bytes are free on a specified disk drive.
  94.  
  95.    BytesFree& = DriveSpace&(Drive$)
  96.  
  97. Drive$      letter of the drive to examine
  98. -------
  99. BytesFree&  free bytes on the specified drive, or -1 if bad drive or disk error
  100.  
  101. Name  : EMSBuffer
  102. Class : Memory
  103. Level : BIOS
  104.  
  105. EMSBuffer tells you how many bytes are needed to save the state of the EMS
  106. array routines.  Used in conjunction with EMSSave and EMSRest, it allows you
  107. to preserve EMS arrays across a CHAIN to another part of your program.
  108.  
  109.    EMSBuffer Bytes%
  110.    EMSState$ = SPACE$(Bytes%)
  111.    EMSSave EMSState$
  112.  
  113. -------
  114. Bytes%       bytes needed to save EMS array state
  115.  
  116.  
  117. Name  : EMSClose
  118. Class : Memory
  119. Level : BIOS
  120.  
  121. The EMSClose routine is used when you are finished with an EMS array.  It
  122. frees the array handle and EMS memory for other uses.  If you don't close all
  123. EMS arrays before your program ends, the memory will be lost until the system
  124. is rebooted, so it is important to remember EMSClose.
  125.  
  126.    EMSClose ArrayHandle%
  127.  
  128. ArrayHandle%    handle of an EMS array
  129.  
  130.  
  131. Name  : EMSGet
  132. Class : Memory
  133. Level : BIOS
  134.  
  135. This routine gets an element from an EMS array created by EMSOpen.  Element
  136. numbers start at 0.  Be sure to use the right numeric type for the array--
  137. for instance, if you opened the array for SINGLE precision, use "Value!".
  138.  
  139.    EMSGet ArrayHandle%, ElementNr&, Value
  140.  
  141. ArrayHandle%    handle of an EMS array
  142. ElementNr&      element number to get
  143. -------
  144. Value           value to get element into (must be correct type for array)
  145.  
  146.  
  147. Name  : EMSOpen
  148. Class : Memory
  149. Level : BIOS
  150.  
  151. This routine allows you to open a block of EMS (expanded) memory which can
  152. then be accessed like a numeric array.  The array size is limited only by
  153. available EMS memory (use GetLIMM to find out how much is available).  You
  154. may specify any numeric type:
  155.  
  156.     1   INTEGER
  157.     2   LONG or SINGLE
  158.     3   DOUBLE
  159.  
  160. When the array is opened, you are returned an "array handle" which is used to
  161. access that array.  Access to the array is done via EMSGet and EMSPut.  When
  162. you are finished with the array, you must close it with EMSClose.
  163.  
  164. As many as 25 EMS arrays can be in use at one time, subject to limitations
  165. which may be imposed by your EMS driver (each array requires one EMS handle).
  166.  
  167.    EMSOpen Elements&, ElementType%, ArrayHandle%, ErrCode%
  168.  
  169. Elements&       number of elements in array (like DIM size)
  170. ElementType%    numeric type of array (see above)
  171. -------
  172. ArrayHandle%    handle of an EMS array
  173. ErrCode%        whether an error occurred (0 no)
  174.  
  175.  
  176. Name  : EMSPut
  177. Class : Memory
  178. Level : BIOS
  179.  
  180. This routine puts an element into an EMS array created by EMSOpen.  Element
  181. numbers start at 0.  Be sure to use the right numeric type for the array--
  182. for instance, if you opened the array for SINGLE precision, use "Value!".
  183.  
  184.    EMSPut ArrayHandle%, ElementNr&, Value
  185.  
  186. ArrayHandle%    handle of an EMS array
  187. ElementNr&      element number to set
  188. Value           value to set element to (must be correct type for array)
  189.  
  190.  
  191. Name  : EMSRest
  192. Class : Memory
  193. Level : BIOS
  194.  
  195. This routine allows you to restore the state of the EMS array handler.  Used
  196. in conjunction with EMSBuffer and EMSSave, it allows you to preserve EMS
  197. arrays across a CHAIN to another part of your program.
  198.  
  199.    EMSRest EMSState$
  200.  
  201. EMSState$    saved EMS array state
  202.  
  203.  
  204. Name  : EMSSave
  205. Class : Memory
  206. Level : BIOS
  207.  
  208. This routine allows you to save the state of the EMS array handler.  Used in
  209. conjunction with EMSBuffer and EMSRest, it allows you to preserve EMS arrays
  210. across a CHAIN to another part of your program.
  211.  
  212.    EMSBuffer Bytes%
  213.    EMSState$ = SPACE$(Bytes%)
  214.    EMSSave EMSState$
  215.  
  216. -------
  217. EMSState$    saved EMS array state
  218.  
  219.  
  220. Name  : EnhKbd
  221. Class : Input
  222. Level : BIOS
  223.  
  224. By default, the PBClone routines assume an old-style keyboard is in use, for
  225. greatest compatibility.  EnhKbd allows you to turn on enhanced keyboard
  226. handling for the current generation of (usually) 101-key keyboards.  This
  227. allows access to the F11 and F12 function keys as well as codes for key
  228. combinations that used to be ignored, among other things.
  229.  
  230. The KbdType or KbdType2% routine can be used to determine if an enhanced
  231. keyboard is available (recommended).
  232.  
  233. Note that EnhKbd works by intercepting the BIOS keyboard handler.  All calls
  234. to the BIOS keyboard interrupt are converted from the old keyboard functions
  235. to the new ones.  YOU MUST DISABLE EnhKbd BEFORE YOUR PROGRAM ENDS, so it can
  236. restore the old setup.  Otherwise, the computer will most probably crash.
  237.  
  238.    EnhKbd Enable%
  239.  
  240. Enable%     turn on enhanced keyboard support (0 disable, else enable)
  241.  
  242.  
  243. Name  : GetDOSV                 (Called by DoorFrame - DON'T DELETE!)
  244. Class : Equipment
  245. Level : DOS
  246.  
  247. The GetDOSV routine tells you what version of DOS you're using.  It returns
  248. the results as two integers containing the major and minor version numbers.
  249. For instance, MS-DOS 2.11 would return a major number of 2, minor 11.
  250.  
  251. The OS/2 compatibility box returns version numbers beginning at 10.00.  For
  252. instance, OS/2 v1.1 returns 10.10 and OS/2 v2.0 returns 20.00.
  253.  
  254.    GetDOSV MajorV%, MinorV%
  255.  
  256. -------
  257. MajorV%   major part of the DOS version
  258. MinorV%   minor part of the DOS version
  259.  
  260.  
  261. Name  : GetDView
  262. Class : Miscellaneous
  263. Level : DOS
  264.  
  265. The GetDView routine tells you what version of DESQview is loaded.  It
  266. returns the results as two integers containing the major and minor version
  267. numbers.  For instance, DESQview 2.0 would return a major number of 2 and a
  268. minor number of 0.  If DESQview is not loaded, zeroes are returned.
  269.  
  270. See also GetTView, GetTVScreen, UpdTVScreen.
  271.  
  272.    GetDView MajorV%, MinorV%
  273.  
  274. -------
  275. MajorV%   major part of the DESQview version (0 if DESQview is not loaded)
  276. MinorV%   minor part of the DESQview version
  277.  
  278.  
  279. Name  : GetKbd
  280. Class : Input
  281. Level : Clone
  282.  
  283. The GetKbd routine allows you to get the state of the four keyboard toggles:
  284. Insert, Caps lock, Num lock, and Scroll Lock.
  285.  
  286.    GetKbd Insert%, Caps%, Num%, Scrl%
  287.  
  288. -------
  289. Insert%    whether "insert" mode is on (0 if no)
  290. Caps%      whether "caps lock" is on (0 if no)
  291. Num%       whether "num lock" is on (0 if no)
  292. Scrl%      whether "scroll lock" is on (0 if no)
  293.  
  294.  
  295. Name  : GetKbd1
  296. Class : Input
  297. Level : Clone
  298.  
  299. The GetKbd1 routine allows you to get the state of the four keyboard shift
  300. keys: Left shift, Right shift, Control and Alt.
  301.  
  302.    GetKbd1 LShift%, RShift%, Control%, Alt%
  303.  
  304. -------
  305. LShift%    whether the left shift key is depressed (0 if no)
  306. RShift%    whether the right shift key is depressed (0 if no)
  307. Control%   whether a control key is depressed (0 if no)
  308. Alt%       whether an alt key is depressed (0 if no)
  309.  
  310.  
  311. Name  : GetKbd2
  312. Class : Input
  313. Level : AT BIOS
  314.  
  315. The GetKbd2 routine allows you to get the state of the six keyboard shift
  316. keys on an "enhanced" keyboard: Left shift, Right shift, Left Control, Right
  317. Control, Left Alt and Right Alt.
  318.  
  319. Normally, the BIOS only lets you see one key at a time, which can be a
  320. barrier when you need more input.  This is a particular problem with action
  321. games and other real-time applications which have complex input requirements.
  322. Due to the special way the BIOS treats shift keys, GetKbd2 can tell if the
  323. the various shift keys are pressed simultaneously, allowing more flexibility.
  324.  
  325.    GetKbd2 LShift%, RShift%, LCtrl%, RCtrl%, LAlt%, RAlt%
  326.  
  327. -------
  328. LShift%    whether the left shift key is depressed (0 if no)
  329. RShift%    whether the right shift key is depressed (0 if no)
  330. LCtrl%     whether the left control key is depressed (0 if no)
  331. RCtrl%     whether the right control key is depressed (0 if no)
  332. LAlt%      whether the left alt key is depressed (0 if no)
  333. RAlt%      whether the right alt key is depressed (0 if no)
  334.  
  335.  
  336. Name  : GetLIMHandles
  337. Class : Memory
  338. Level : DOS
  339.  
  340. Early Lotus/Intel/Microsoft expanded memory revisions provided a limited
  341. number of "handles" which could be used to access expanded memory-- often as
  342. few as 15 or so.  If your program uses expanded memory and the EMS driver is
  343. one of the older versions, you may want to make sure that enough handles are
  344. available.  This routine tells you how many handles are in use.
  345.  
  346. Note that this routine expects an EMS driver to be installed.  If you can't
  347. be sure of that, use GetLIMM first to avoid an unpleasant surprise.
  348.  
  349.    GetLIMHandles Handles%
  350.  
  351. -------
  352. Handles%  number of EMS handles in use
  353.  
  354.  
  355.  
  356. Name  : GetLIMM
  357. Class : Memory / Equipment
  358. Level : DOS
  359.  
  360. This routine tells you how much expanded memory is installed.  If there is
  361. none, or if the EMS driver hasn't been installed, it returns zeroes.  You
  362. should use this routine before any other of the PBClone routines that access
  363. expanded memory, since the other routines expect EMS to be available.
  364.  
  365. The results are returned in terms of EMS pages.  Each page is 16 kilobytes.
  366.  
  367.    GetLIMM TotalPages%, FreePages%
  368.  
  369. -------
  370. TotalPages%  number of EMS pages installed
  371. FreePages%   number of EMS pages available for use
  372.  
  373.  
  374. Name  : GetLIMV
  375. Class : Memory / Equipment
  376. Level : DOS
  377.  
  378. The GetLIMV routine tells you the version of EMS driver that is being used.
  379. The version number is separated into major and minor parts.  For example, an
  380. EMS 3.1 driver would return a major number of 3 and minor number of 1.
  381.  
  382. Note that this routine expects an EMS driver to be installed.  If you can't
  383. be sure of that, use GetLIMM first to avoid an unpleasant surprise.
  384.  
  385.    GetLIMV MajorVer%, MinorVer%
  386.  
  387. -------
  388. MajorVer%  major part of the EMS version number
  389. MinorVer%  minor part of the EMS version number
  390.  
  391.  
  392. Name  : KbdType
  393. Class : Input / Equipment
  394. Level : Clone
  395.  
  396. This routine tells you if an enhanced (101-key) keyboard is available.
  397.  
  398. KbdType differs from the ProBas routine of the same name in that it has
  399. additional error checking.  If it is not entirely sure that an enhanced
  400. keyboard is available, it plays safe and assumes there isn't one.  This
  401. avoids possible disaster on older PCs.
  402.  
  403.    KbdType Enhanced%
  404.  
  405. -------
  406. Enhanced%    whether keyboard is of the enhanced type (0 no)
  407.  
  408.  
  409. Name  : KeyPress
  410. Class : Input
  411. Level : DOS
  412.  
  413. This routine works like the Turbo/Power BASIC function INSTAT.  It tells you
  414. whether there is a key waiting to be processed.
  415.  
  416.    KeyPress KeyHit%
  417.  
  418. -------
  419. KeyHit%   whether a key is waiting (0 if no)
  420.  
  421.  
  422. Name  : LClose
  423. Class : Memory
  424. Level : BIOS
  425.  
  426. This routine closes a block of expanded memory that was opened for access by
  427. LOpen.  It is important to close the block when you are finished with it, to
  428. return it to the free memory pool.
  429.  
  430. Routines in this suite include: LOpen, LGet, LPut, LClose.
  431.  
  432.    LClose EMSHandle%
  433.  
  434. EMSHandle%    handle of the expanded memory block
  435.  
  436.  
  437. Name  : LGet
  438. Class : Memory
  439. Level : BIOS
  440.  
  441. This routine gets a block of data from expanded memory that was opened for
  442. access by LOpen.  The amount of data is specified in words; one word is the
  443. same as two bytes.  An integer takes up a word, long integers and single
  444. precision numbers require two words, and double precision numbers take four.
  445.  
  446. Routines in this suite include: LOpen, LGet, LPut, LClose.
  447.  
  448.    LGet EMSHandle%, DSeg%, DOfs%, Words%
  449.  
  450. EMSHandle%    handle of the expanded memory block
  451. DSeg%         segment of place to store data
  452. DOfs%         offset of place to store data
  453. Words%        words to get from expanded memory
  454.  
  455.  
  456. Name  : LOpen
  457. Class : Memory
  458. Level : BIOS
  459.  
  460. This routine opens a block of expanded memory for access.  The size of the
  461. block is specified in words; one word is the same as two bytes.  An integer
  462. takes up a word, long integers and single precision numbers require two
  463. words, and double precision numbers take four.  This allows you to store up
  464. to 64K in each EMS block that you open.
  465.  
  466. Note that LOpen expects an EMS driver to be available.  If you are not
  467. certain on this point, use GetLIMM beforehand to make sure.
  468.  
  469. Routines in this suite include: LOpen, LGet, LPut, LClose.
  470.  
  471.    LOpen Words%, EMSHandle%, ErrCode%
  472.  
  473. Words%        size of expanded memory block to allocate
  474. -------
  475. EMSHandle%    handle of the expanded memory block
  476. ErrCode%      error code (0 if no error)
  477.  
  478.  
  479. Name  : LPut
  480. Class : Memory
  481. Level : BIOS
  482.  
  483. This routine puts a block of data into expanded memory that was opened for
  484. access by LOpen.  The amount of data is specified in words; one word is the
  485. same as two bytes.  An integer takes up a word, long integers and single
  486. precision numbers require two words, and double precision numbers take four.
  487.  
  488. Routines in this suite include: LOpen, LGet, LPut, LClose.
  489.  
  490.    LPut EMSHandle%, DSeg%, DOfs%, Words%
  491.  
  492. EMSHandle%    handle of the expanded memory block
  493. DSeg%         segment of place from which to get data
  494. DOfs%         offset of place from which to get data
  495. Words%        words to put into expanded memory
  496.  
  497.  
  498. Name  : LRotate
  499. Class : String
  500. Level : Any
  501.  
  502. Many years ago, I wrote one of the first terminal programs for the PC.  It
  503. died a horrible death when Qmodem came out... sigh.  This routine comes from
  504. that experience.  It rotates the characters in a string left once (e.g.,
  505. "ABCDE" becomes "BCDEA").  I used this in my routine to dial a list of BBSes,
  506. skipping to the next one if the current one was busy.
  507.  
  508. LRotate can also be handy for things like scrolling a long message across the
  509. screen (you just PRINT LEFT$(Message$, 80); then delay a bit, LRotate and do
  510. it again).
  511.  
  512.    LRotate St$
  513.  
  514. St$     string to be rotated left once
  515. -------
  516. St$     string after being rotated left once
  517.  
  518.  
  519. Name  : NameCase                (Called by DoorFrame - DON'T DELETE!)
  520. Class : String
  521. Level : Any
  522.  
  523. This routine provides a specialized uppercase/lowercase converter designed
  524. especially for names.  It converts the first letter in each word in a string
  525. to uppercase, with the rest of the word being converted to lowercase.
  526.  
  527. See also NameCase2, the FUNCTION version of this routine.
  528.  
  529.    NameCase St$
  530.  
  531. St$         string to process
  532. -------
  533. St$         processed string
  534.  
  535.  
  536. Name  : Processor
  537. Class : Equipment
  538. Level : Any
  539.  
  540. Processor returns the type of processor (CPU) installed.
  541.  
  542. Results are returned as follows:
  543.  
  544.    0    NEC V20
  545.    1    8088 or 8086
  546.    2    80186
  547.    3    80286
  548.    4    80386 or 80486
  549.  
  550. If anyone can tell me how to better handle a 486 here, I'd appreciate it.
  551.  
  552. The ProBas version of this routine can't recognize a NEC processor.
  553.  
  554.    Processor ProcType%
  555.  
  556. -------
  557. ProcType%    type of CPU (see above)
  558.  
  559.  
  560. Name  : Retries
  561. Class : Disk
  562. Level : DOS 3.1+
  563.  
  564. This routine allows you to adjust the handling of file-sharing errors.  When
  565. such an error occurs, DOS normally retries 3 times, with a wait of 1 between
  566. tries.  This allows temporary conditions, such as someone else using the file
  567. you want to access, to clear up.  In many cases, though, you may want to
  568. change this delay.  A shorter delay will improve response time, allowing your
  569. program to handle the error more quickly.  A longer delay may be more suited
  570. for a busy network, allowing the request to proceed after a reasonable
  571. waiting period.
  572.  
  573. The delay period between each retry is unfortunately machine-dependent, i.e.,
  574. you will need larger delays on faster machines to achieve the same effect.
  575. This can only be considered a flaw in DOS.
  576.  
  577. Note that shorter waiting periods will improve response time for your
  578. program, but may adversely affect the network.  Normally, you should use the
  579. longest waiting period with which you feel comfortable.
  580.  
  581.    Retries Times%, WaitTime%
  582.  
  583. Times%     number of times to retry if a file-sharing violation occurs
  584. WaitTime%  amount of time to delay between retries
  585.  
  586.  
  587. Name  : SetError
  588. Class : Miscellaneous
  589. Level : DOS
  590.  
  591. The SetError routine allows you to set the "error level" to be returned by
  592. DOS when your program ends.  This is particularly handy for returning
  593. information to batch files.
  594.  
  595. Note that SetError is best used just before your program ENDs, to avoid
  596. complications.
  597.  
  598.    SetError ErrorLevel%
  599.  
  600. ErrorLevel%   exit code to be returned by your program
  601.  
  602.  
  603. Name  : SetKbd
  604. Class : Input
  605. Level : Clone
  606.  
  607. The SetKbd routine allows you to set the state of any of the four keyboard
  608. toggles: Insert, Caps lock, Num lock, and Scroll Lock.  You can give your
  609. input routines a professional touch by setting this toggles instead of making
  610. the user remember to do so.
  611.  
  612. It's considered proper to restore the original keyboard toggles before your
  613. program exits, unless of course the purpose of the program is to leave the
  614. toggles in a particular state!  The GetKbd routine can be used in conjunction
  615. with SetKbd to do this.
  616.  
  617.    SetKbd Insert%, Caps%, Num%, Scrl%
  618.  
  619. Insert%    whether to turn on "insert" mode (0 if no)
  620. Caps%      whether to turn on "caps lock" (0 if no)
  621. Num%       whether to put the keypad into numeric mode (0 if no)
  622. Scrl%      whether to turn on "scroll lock" (0 if no)
  623.  
  624.  
  625. Name  : Soundex
  626. Class : String
  627. Level : Any
  628.  
  629. This is a string comparison routine which returns a code that is loosely
  630. based on the "sound" of a word.  It removes the vowels and repeated
  631. characters from a word, then converts it into a numeric code.  Any words with
  632. the same code are considered to sound alike.
  633.  
  634. While not perfect, this algorithm does a fast and reasonably good job.  It
  635. can be helpful in applications like spelling checkers and phone books, where
  636. a search based on exact text may not be appropriate.
  637.  
  638.    Code$ = St$
  639.    Soundex St$, Code$, CodeLen%
  640.    Code$ = LEFT$(St$, CodeLen%)
  641.  
  642. St$       string to be encoded
  643. -------
  644. Code$     result code.  Init to at least the length of the original string.
  645. CodeLen%  length of the result code
  646.  
  647. 
  648.